package ws.jonas.common.model;

import java.util.ArrayList;
import java.util.Iterator;

public class Product implements Iterable<Store> {
	private final int prodnr;
	private String name;
	private ArrayList<Store> stores;
	
	public Product(int prodnr) {
		stores = new ArrayList<Store>();
		this.prodnr = prodnr;
	}
	
	public void addStore(Store store) {
		stores.add(store);
	}
	
	public int getProdnr() {
		return prodnr;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public String getName() {
		return name;
	}
	
	public int getSize() {
		return stores.size();
	}
	
	@Override
	public Iterator<Store> iterator() {
		return stores.iterator();
	}
	
	@Override
	public String toString() {
		return "Product[ name=" + name + ", prodnr=" + prodnr + ", stores=" + stores + " ]";
	}
}
